package cn.edu.seig.textbook.service.impl;

import cn.edu.seig.textbook.domain.pojo.Requests;
import cn.edu.seig.textbook.enums.RequestEnum;
import cn.edu.seig.textbook.mapper.RequestsMapper;
import cn.edu.seig.textbook.service.IRequestsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author day
 * @since 2024-11-07
 */
@Service
public class RequestsServiceImpl extends ServiceImpl<RequestsMapper, Requests> implements IRequestsService {
    @Autowired
    private RequestsMapper requestsMapper;

    @Override
    public List<Requests> getRequestsByStatus(@Param("requestStatus") RequestEnum requestStatus){
        return requestsMapper.getRequestsByStatus(requestStatus);
    }
    @Override
    public List<Requests> getRequestsByTeacherName(@Param("teacherName") String teacherName){
        return requestsMapper.getRequestsByTeacherName(teacherName);
    }
    @Override
    public int addRequest(Requests request){
        return requestsMapper.addRequest(request);
    }
    @Override
    public int updateRequest(Requests request){
        return requestsMapper.updateRequest(request);
    }
    @Override
    public int deleteRequest(@Param("requestId") int requestId){
        return requestsMapper.deleteRequest(requestId);
    }

    @Override
    public List<Requests> findAll() {
        return requestsMapper.selectList(null);
    }

}
